import React, {PropTypes} from 'react';
import ListItem from '../ListItem';

const propTypes = {
	items: PropTypes.array.isRequired,
	onSelect: PropTypes.func.isRequired,
}

function List({items, onSelect}) {


	const data = items.map(
			el => (
				<ListItem item={el} key={el.id} onClick={() => onSelect(el.id)}/>
			)
		);
	console.log(data)

	return (
			<div>
			{data}
			</div>
		);
}

List.propTypes = propTypes;

export default List;